package com.opal.stockTaking.mapper.oracle;

import com.opal.system.entity.table.PKOrg;
import com.opal.stockTaking.entity.BdStordoc;
import com.opal.stockTaking.entity.StockTakingResult;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface StockTakingHelpMapper {

    @Select("select name,pk_factory pkOrg from org_factory")
    List<PKOrg> getpkorg();

    @Select("select code,name,pk_stordoc from bd_stordoc order by name")
    @Results({
            @Result(column = "code", property = "code"),
            @Result(column = "name", property = "name"),
            @Result(column = "pk_stordoc", property = "pkStordoc")
    })
    List<BdStordoc> getBdStordoc();



    @Select("select name from(select ROWNUM,name from bd_material where code = #{materialCode} and ROWNUM = 1)")
    String getmaterialName(String materialCode);

    //获取物料分类
    @Select("select substr(code,2,1) from bd_material where code=#{materialCode}")
    int getmaterialclass(String materialCode);


    //sql1
    List<StockTakingResult> selectOne(@Param("org") String org, @Param("cwarehouseid") List<String> cwarehouseid);

    //sql2
    List<StockTakingResult> selectTwo(@Param("org") String org, @Param("cwarehouseid") List<String> cwarehouseid);

}
